home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 020a / getmenow.zip / RMLIST.DOC < prev   
Text File  |  1992-02-17  |  12KB  |  301 lines

  1.  
  2.  
  3.  
  4.  
  5.                ┌───────────────────────────────────────────────────────┐
  6.                │                                                       │
  7.                │                                                       │
  8.                │                                                       │
  9.                │                                                       │
  10.                │                      RMLIST.BAT                       │
  11.                │                                                       │
  12.                │                                                       │
  13.                │                Automated file deletion                │
  14.                │                                                       │
  15.                │                                                       │
  16.                │                   February 16, 1992                   │
  17.                │                                                       │
  18.                │                                                       │
  19.                │                                                       │
  20.                │                                                       │
  21.                │                                                       │
  22.                └───────────────────────────────────────────────────────┘
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.      If you're a graphics nut, like me, then more likely than not
  54. you've moved large numbers of files off of your hard drive onto
  55. floppy disks, to free up space on the hard drive.  If you're
  56. dealing with several hundred files or even just a few large ones,
  57. removing the files from the hard drive by typing the names in one
  58. at a time can be a real chore.  And you can't just do "del *.*"
  59. if you didn't get them all copied.  So you're in for a long,
  60. boring, typing session which is probably why you let that many
  61. accumulate, in the first place (other kinds of nuts have this
  62. problem too).  Well, ya don't have to do it that way any more
  63. because now you can automate the file removal with RMLIST.BAT.
  64.  
  65.      RMLIST.BAT is a simple batch file that controls some
  66. powerful system utilities that will take the drudgery out of that
  67. file removal job and make you grin (guaranteed).  In reference to
  68. the listings and descriptions that follow, some preliminary
  69. explanation may be in order (or not).  You will notice the path
  70. names in RMLIST.BAT.  I prefer a short path in my system setup
  71. and perform most operations using batch files that have the
  72. necessary file path information in them.  Doesn't have to be done
  73. that way but, that's the way I do it.  This listing is of the
  74. actual batch file that I use, hence, the file paths.  C:\batch is
  75. where I keep all of my batch files (it's in the system path). 
  76. C:\batch\tmp is the place where I do garbage work like THIS. 
  77. There's never anything of value in there and so I don't worry
  78. about corrupting something.
  79.  
  80. Here's the numbered listing for RMLIST.BAT, an explanation of how
  81. to use it and what it does:
  82.  
  83.  
  84. 1: DIR %1: >C:\BATCH\TMP\FILES.TXT
  85. 2: CUTPASTE C:\BATCH\TMP\FILES.TXT C:\BATCH\TMP\FILES.BAT
  86. -f="DEL^" 1-8 -f="." 10-12
  87. 3: EDLIN C:\BATCH\TMP\FILES.BAT < C:\BATCH\COMMANDS.LST
  88. 4: CALL C:\BATCH\TMP\FILES.BAT
  89. 5: DEL C:\BATCH\TMP\FILES.*
  90.  
  91.  
  92.      You should be in the directory where the files you are
  93. transferring to floppy disk are located.  If you aren't, CD to
  94. that directory.  Then, copy some files to media in your floppy
  95. disk drive.  If you want to copy everything in the directory just
  96. use "copy *.* a:".  "a" being the floppy drive you are copying
  97. to.  If you don't want to copy everything in the directory, then
  98. sit there and type 'em in by hand (we're trying to eliminate all
  99. this typing, remember?).  The other stuff will be safe,
  100. RMLIST.BAT will only remove the files you have copied to the
  101. floppy drive.  When you have filled up the floppy disk, the
  102. system will display an error message like:  "insufficient disk
  103. space" and report how many files were SUCCESSFULLY copied.  When
  104. the copy on the last file failed, the directory did not get
  105. updated so that file will not list and therefore will not be
  106. removed by RMLIST.BAT.
  107.  
  108. When you call RMLIST.BAT, the command line should be:
  109.  
  110. rmlist [drive designator]
  111.  
  112. drive designator being the floppy drive you just copied the files
  113. to (our example is using "a").  DO NOT type in the colon after
  114. the drive letter.  If you do, RMLIST.BAT will fail and remove
  115. nothing.  You can change the batch file if you find this hard to
  116. get used too.  Just edit out the first colon in line one of
  117. RMLIST.BAT.  Then you can do that unnecessary key press for the
  118. colon.
  119.  
  120. Note:     The floppy disk you just copied to, must be in the
  121.           designated disk drive for this to work.
  122.  
  123. So...  you've just typed in "rmlist a".  Now, press ENTER, lean
  124. back, and experience instant gratification, while the COMPUTER
  125. does the work (that IS what they're supposed to do).
  126.  
  127. OKAY - COOL........  SO WHAT HAPPENED? (explain the process)
  128.  
  129. RMLIST.BAT
  130. line 1:   reads the directory of the floppy in the designated
  131.           drive (in this case "a") and writes that directory
  132.           listing to the file "c:\batch\tmp\files.txt".  The
  133.           listing will be similar to this:
  134.  
  135.            Volume in drive B is GRAPHICS   
  136.            Directory of B:\
  137.  
  138.           MOONWLK  PCX     31274 02-07-91   9:06p
  139.           AUSSIE   PCX     50177 11-14-88   7:44p
  140.           CV1-50C  PCX      6413 09-10-89   5:36a
  141.           CV1-54C  PCX      3657 09-10-89   5:36a
  142.  
  143.  
  144.           ( LOTS MORE STUFF LISTED HERE )
  145.  
  146.  
  147.  
  148.           CV2-33T  PCX      9658 10-28-89   9:56p
  149.           CV3-02M  PCX      8858 09-10-89   5:37a
  150.           CV3-05T  PCX      7516 09-10-89   5:37a
  151.           CV3-07M  PCX     13660 09-10-89   5:37a
  152.           CV3-08M  PCX     12666 09-10-89   5:37a
  153.                  21 file(s)     349724 bytes
  154.                                   2048 bytes free
  155.  
  156.  
  157. line 2:   calls the program "CUTPASTE.EXE" (if you're reading
  158.           this, you should have this program).  This program
  159.           should be kept in a directory in your system path so
  160.           that you can call it from anywhere.  CUTPASTE reads the
  161.           "c:\batch\tmp\files.txt" file, strips off everything
  162.           but the file names, pastes in the text:  "DEL^" and a
  163.           period (.) between the file name and it's extension and
  164.           writes it back out to the file
  165.           "c:\batch\tmp\files.bat".  The circumflex character (^)
  166.           is important as a place holder (as you will see).  When
  167.           CUTPASTE is finished, "c:\batch\tmp\files.bat" will
  168.           look like this:
  169.  
  170.           DEL^ Volume .n d
  171.           DEL^ Directo.y o
  172.           DEL^MOONWLK .PCX
  173.           DEL^AUSSIE  .PCX
  174.           DEL^CV1-50C .PCX
  175.           DEL^CV1-54C .PCX
  176.  
  177.  
  178.           ( LOTS MORE STUFF LISTED HERE )
  179.  
  180.  
  181.  
  182.           DEL^CV2-33T .PCX
  183.           DEL^CV3-02M .PCX
  184.           DEL^CV3-05T .PCX
  185.           DEL^CV3-07M .PCX
  186.           DEL^CV3-08M .PCX
  187.           DEL^       2. fi
  188.           DEL^        .   
  189.  
  190. line 3:   calls "EDLIN" (the MICROSOFT system line editor) to
  191.           take out the spaces between the file names and the
  192.           period (.) that separates the file name extensions
  193.           (this is why we put the circumflex (^) in the records). 
  194.           Edlin then removes the first two lines from the listing
  195.           and the last two lines from the listing (because they
  196.           are garbage, not valid file names).  And last but not
  197.           least, EDLIN replaces all the circumflex characters
  198.           with space characters so that each line looks like
  199.           this:
  200.  
  201.           DEL CV2-33T.PCX
  202.           DEL CV#-02M.PCX   (etc....  etc....  etc....)
  203.  
  204.           Where did EDLIN get the instructions to do all this? 
  205.           From a command script in the c:\batch directory, called
  206.           "commands.lst" (betcha didn't know you could do that). 
  207.           EDLIN is a great tool.  Too bad it's not documented
  208.           better.  Anyway....  so now you've created a batch file
  209.           that can be executed.
  210.  
  211. line 4:   executes the batch file created in line three, as a
  212.           child process and deletes all the files on (we're
  213.           presuming) drive c:, that were copied to drive a:.
  214.  
  215. line 5:   The child process in line 4 has terminated and
  216.           RMLIST.BAT cleans up by deleting the work files and the
  217.           batch file "files.bat", in the c:\batch\tmp directory
  218.           using the command "DEL c:\batch\tmp\files.*"
  219.  
  220. ( WHEW! )
  221.  
  222. All done.  So now you can repeat the process with a new floppy
  223. disk.  Copy files, run RMLIST.BAT, copy files, run RMLIST.BAT. 
  224. You'll have that old hard drive cleaned up in no time!
  225.  
  226. And when you get done, it would be a good idea to run MICROSOFT's
  227. "chkdsk" program to cleanup any fragmentation that may have
  228. resulted from all that activity.  BUT, please read the manual
  229. before you run it as certain conditions make running it
  230. unadvisable.
  231.  
  232. The file:  "c:\batch\commands.lst" contains instructions for
  233. edlin to run unattended.  The instructions are cryptic if your
  234. not familiar with edlin and not much more easily understood by
  235. many who ARE familiar with it.  The following is a listing (with
  236. line numbers) of that command script and an explanation:
  237.  
  238. 1: #
  239. 2: -1
  240. 3:
  241. 4: 1,r ^Z           (the ^Z ends this line)
  242. 5: #
  243. 6: -1
  244. 7:
  245. 8: 1,r^^Z      (there is a SPACE character at the end of this
  246.                line)
  247. 9: #
  248. 10: -1d
  249. 11: -1d
  250. 12: 1,2d
  251. 13: e
  252.  
  253. line 1:   tells edlin to go to the end of the file
  254. line 2:   sets the pointer to the last line of the file
  255. line 3:   is blank, to simulate a press of the ENTER key
  256. line 4:   tells edlin to replace all spaces with nothing, from
  257.           line 1 to the end of the file
  258. line 5:   tells edlin to go to the end of the file
  259. line 6:   sets the pointer to the last line of the file
  260. line 7:   is blank, to simulate a press of the ENTER key
  261. line 8:   tells edlin to replace the circumflex character (^)
  262.           with a space, from line 1 to the end of the file.  The
  263.           space character follows the "^Z" character and is
  264.           invisible (naturally).  The "^Z" character is generated
  265.           with the F6 key.
  266. line 9:   tells edlin to go to the end of the file
  267. line 10:  tells edlin to set the pointer to the last line and
  268.           delete the line
  269. line 11:  tells edlin to set the pointer to the last line and
  270.           delete the line
  271. line 12:  tells edlin to delete lines 1 and 2
  272. line 13:  tells edlin to quit and save the edit session
  273.  
  274. Now, if you list commands.lst to the screen or printer, all of
  275. the characters shown in this listing will not appear, but, they
  276. are there.  This is because some of the characters (^Z) are
  277. mistaken for END OF FILE MARKERS.  If you feel the need to load
  278. this file into an editor, use EDLIN with the /B switch.
  279.  
  280. BEGGING FOR BUCKS
  281.      Hey!  You can't call this shareware!  No, not by any stretch
  282. of the imagination.  It's just a technique I devised that has
  283. saved me lots of time and I wanted to share it with you.  If you
  284. like it, use it.  Pass it around to your friends and co-workers. 
  285. Upload it to other BBS.  I only ask that you keep the package
  286. intact.  All of the files are important and one of them is not a
  287. "freebee".
  288.  
  289.      Correspondence regarding RMLIST.BAT and/or the rest of this
  290. package is most welcome and should be directed to:
  291.  
  292.                          Bill Leckband
  293.                          1628 S. Everett Place
  294.                          Kennewick, Wa.  99336
  295.  
  296.  
  297.  
  298.  
  299.  
  300. MICROSOFT is a registered trademark of Microsoft Corp.
  301. CHKDSK and EDLIN are copyrighted products of Microsoft Corp.